import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.Timer;
import javax.swing.border.EmptyBorder;
import javax.swing.JButton;
import java.awt.SystemColor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JLabel;


public class Main extends JFrame {

	private JPanel contentPane;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					Main frame = new Main();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public Main() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JPanel panel = new JPanel();
		panel.setBackground(SystemColor.window);
		panel.setBounds(44, 35, 100, 100);
		contentPane.add(panel);
		panel.setLayout(null);
		
		final JLabel[] label = new JLabel[10];
		label[0] = new JLabel("Jejemon ka!");
		label[0].setBounds(0, 0, 100, 50);
		panel.add(label[0]);
		
		label[1] = new JLabel("Jejemon ka!");
		label[1].setBounds(0, 50, 100, 50);
		panel.add(label[1]);
		
		
		final Timer t = new Timer(2000, new ActionListener(){
			public void actionPerformed(ActionEvent e){
				for(int i=1;i<=5;i++){
						if(i==1){
							label[0].setVisible(false);
							label[1].setVisible(true);
						}
						else if(i==2){
							label[0].setVisible(true);
							label[1].setVisible(false);
						}	
						else if(i==3){
							label[0].setVisible(false);
							label[1].setVisible(true);
						}
						else if(i==4){
							label[0].setVisible(true);
							label[1].setVisible(false);
						}
						else if(i==5){
							label[0].setVisible(true);
							label[1].setVisible(true);
						}
				}
			}
		});
		final JButton btnClickMe = new JButton("Click Me!");
		btnClickMe.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				for(int i=1;i<=5;i++) {
					t.start();
					btnClickMe.setEnabled(false);
				}
			}
		});
		btnClickMe.setBounds(44, 169, 89, 23);
		contentPane.add(btnClickMe);
	}
}
